import request from '@/utils/request';
export type ParamsType = {
  type: 'a' | 'c';
  source: string;
};
/** 获取评论 */
export const getCommentsByIdAPI = (params: ParamsType) => {
  return request({
    url: '/v1_0/comments',
    params,
  });
};

export type commType = {
  target: string;
  content: string;
  art_id?: string;
};
/** 对文章或者评论进行评论 */
export const submitCommentAPI = (data: commType) => {
  return request({
    url: '/v1_0/comments',
    method: 'post',
    data,
  });
};

// 1.1 点赞API
export const likeCommentAPI = (id: string) => {
  return request({
    url: '/v1_0/comment/likings',
    method: 'post',
    data: {
      target: id,
    },
  });
};

// 1.2 取消API
export const dislikeCommentAPI = (id: string) => {
  return request({
    url: '/v1_0/comment/likings/' + id,
    method: 'delete',
  });
};
